package com.example.document


import android.util.Log
import android.util.TimeUtils
import android.widget.TextView
import com.example.document.entity.DocEntity
import com.example.quickadapter.BaseQuickAdapter
import com.example.quickadapter.BaseViewHolder
import java.text.SimpleDateFormat
import java.util.Date
import kotlin.math.log

class DocAdapter(layout:Int):BaseQuickAdapter<DocEntity,BaseViewHolder>(layout) {
    init {
        addItemChildClick(arrayListOf(R.id.tv_delete))
    }

    override fun convert(holder: BaseViewHolder, item: DocEntity) {
        holder?.apply {
            setText(R.id.tv_title,item.fileName)
            val sdf = SimpleDateFormat("yyyy-MM-dd HH:MM:ss")
            val time = sdf.format(Date(item.fileTime))
            setText(R.id.tv_time,time)
            setImage(R.id.doc_iv,item.filePath)
        }

       /* holder.getView<TextView>(R.id.tv_delete)
            .setOnClickListener {
                Log.i("===","删除"+item.fileName)
            }*/
    }
}